package com.xxg.renrenorder.controller;

import com.xxg.renrencommon.domain.result.BaseResult;
import com.xxg.renrenorder.dao.bean.CommissionSettingInfo;
import com.xxg.renrenorder.domain.query.ListCommissionQuery;
import com.xxg.renrenorder.domain.query.SaveCommissionQuery;
import com.xxg.renrenorder.service.AfterSalesOrderService;
import com.xxg.renrenorder.service.CommissionSettingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 手续费管理接口
 *
 * @author szj
 * @date 2021/11/29
 */
@Api(tags = "手续费管理接口")
@RestController
@RequestMapping("/commissionSetting")
@AllArgsConstructor
public class CommissionSettingController {
    private final CommissionSettingService commissionSettingService;

    @ApiOperation("保存手续费")
    @RequestMapping(value = "save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE,
            consumes = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({@ApiImplicitParam(name = "query", value = "保存手续费信息", required = true, dataType = "SaveCommissionQuery")})
    public BaseResult<Void> save(@RequestBody @Validated SaveCommissionQuery query) {
        return commissionSettingService.save(query);
    }

    @ApiOperation("查询手续费")
    @RequestMapping(value = "list", method = RequestMethod.GET)
    public BaseResult<List<CommissionSettingInfo>> list() {
        return commissionSettingService.list();
    }

}
